package com.sl.mes.db.service.pd;

import com.sl.mes.db.dao.PdWkProdinvMapper;
import com.sl.mes.db.itf.pd.IPdWkProdinv;
import com.sl.mes.db.vo.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class PdWkProdinvService implements IPdWkProdinv {
    @Resource
    private PdWkProdinvMapper pdWkProdinvMapper;

    /**
     * 根据pk查询生产线物料
     * @param pk_org
     * @return
     */
    @Override
    public PdWkProdinv findById(String pk_org) {
        return pdWkProdinvMapper.selectByPrimaryKey(pk_org);
    }

    @Override
    public List<PdWkProdinv> getPsnJobByProinvId(String cpdwkid) {
        PdWkProdinvExample example=new PdWkProdinvExample();
        //example.or().andIdIn(Arrays.asList(pk_psndoc)).andEnabledEqualTo(true).andDeletedEqualTo(false);
        example.or().andCpdwkidEqualTo(cpdwkid).andDrEqualTo(0);

        List<PdWkProdinv> PdWkProdinvlst=pdWkProdinvMapper.selectByExample(example);

        return PdWkProdinvlst;
    }

    @Override
    public int updateByPrimaryKey(PdWkProdinv pdWkProdinv) {
        return pdWkProdinvMapper.updateByPrimaryKey(pdWkProdinv);
    }

    @Override
    public List<PdWkProdinv> repeatWQuery() {
        PdWkProdinvExample pdWkProdinvExample=new PdWkProdinvExample();
        return pdWkProdinvMapper.selectByExample(pdWkProdinvExample);
    }

}
